package com.example.demo.mapper;

import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.logging.LoggerFactory;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.slf4j.Logger;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: wangtuo
 * @Date: 2020/07/09/9:50
 * @Description:
 */
public class MybatisDao extends SqlSessionDaoSupport {

    private SqlSessionFactory sqlSessionFactory;


    public  void  setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
        super.setSqlSessionFactory(sqlSessionFactory);
        this.sqlSessionFactory = sqlSessionFactory;
    }

    public <T>T select(String key, Object param) {
        if(null == param) {
            return this.getSqlSession().selectOne(key);
        }
        return this.getSqlSession().selectOne(key,param);
    }



}
